﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GrammarGenericSolver.IO
{
    public class FileHandler
    {
        private static FileHandler instance;

        /// <summary>
        /// Singleton do manipulador de arquivo.
        /// </summary>
        public static FileHandler Instance
        {
            get {
                if (instance == null)
                {
                    instance = new FileHandler();
                }
                return FileHandler.instance;
            }
            set { FileHandler.instance = value; }
        }

        private FileHandler()
        {
        }

        /// <summary>
        /// Retorna uma string com o texto que se encontra no path passado.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public string ReadFile(string path)
        {
            string file = System.IO.File.ReadAllText(path);
            return file;
        }
    }
}
